﻿using System.Windows.Controls;
using System.Windows.Interactivity;

namespace Tequila.Phone.Interactivity
{
    /// <summary>
    /// <see cref="TriggerAction{Control}">TriggerAction</see>. Triggers focusing of the associated <see cref="Control">control</see>.
    /// </summary>
    public class ControlSetFocusAction : TriggerAction<Control>
    {
        /// <summary>
        /// Invokes the action.
        /// </summary>
        /// <param name="parameter">The parameter to the action. If the Action does not require a parameter, the parameter may be set to a null reference.</param>
        protected override void Invoke(object parameter)
        {
            AssociatedObject.Focus();
        }
    }
}
